package com.tencent.wuyanzu.dao.impl;

import org.hibernate.Session;
import org.springframework.beans.factory.annotation.Autowired;

import com.tencent.wuyanzu.dao.BaseDao;
import com.tencent.wuyanzu.dao.UserDao;
import com.tencent.wuyanzu.model.User;
import com.tencent.wuyanzu.util.ResultMessage;

public class UserDaoImpl implements UserDao{
	
	@Autowired
	private BaseDao baseDao;
	private Session session;

	@Override
	public ResultMessage addUser(User user) {
		
		baseDao.save(user);
		return ResultMessage.SUCCESS;
		
	}

	@Override
	public ResultMessage updateUser(User user) {
		session = baseDao.getSession();
		session.update(user);
		return ResultMessage.SUCCESS;
	}

	@Override
	public User getUser(int id) {
		return (User) baseDao.getListByKeyValue("uID", id, User.class);
	}
	
	
	
	
	
	
	
	
}
